package main

import "fmt"

//指数性衰变算法
func ExponentialDecay()  {
	cpu:= []float64{
		10,
		15,
		10,
		30,
		20,
		25,
		100,
		10,
		15,
		10,
		30,
		20,
		25,
		80,
		10,
		15,
		10,
		60,
		20,
		25,
		100,
		10,
		15,
		50,
		30,
		20,
		25,
		100,
		10,
		15,
		10,
		30,
		20,
		25,
		100,
		10,
		15,
		10,
		30,
		20,
		25,
		80,
		10,
		15,
		10,
		60,
		20,
		25,
		100,
		10,
		15,
		50,
		30,
		20,
		25,
		100,
	}

	pre := 0.0
	for _,curCpu:= range cpu{
		if pre==0 {
			pre = curCpu
		}

		cpu := 0.95*pre+0.05*curCpu
		pre = cpu

		fmt.Println(cpu)
	}


}